<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />

		<link href="../../css/mui.css" rel="stylesheet" />
		<link href="../../css/common.css" rel="stylesheet" />
		<link href="../../css/iconfont.css" rel="stylesheet" />

		<style>
			.mui-table-view{
			margin-top: 0px !important;
		}
		.intelli_limit{
			float: right;
			margin-right: 20px;
			margin-top: 4px;
			color: gold;
		}
		.mui-icon{
			color: goldenrod;
		}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left touch-action"></a>
			<h1 class="mui-title">智能还款</h1>
		</header>

		<div class="mui-content" id="mui-content">
			<ul class="mui-table-view">
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" id="ip-myincome">
						<span class="mui-icon iconfont icon-wodeshouyi"></span>
						我的收益
						<span class="intelli_limit">￥{{total_income}}</span>
					</a>
				</li>
				<li class="mui-table-view-cell me-setting-exit">
					<a class="mui-navigate-right" id="mybalance">
						<span class="mui-icon iconfont icon-wodeyue"></span>
						我的余额
						<span class="intelli_limit">￥{{balance}}</span>
					</a>
				</li>
				<li class="mui-table-view-cell">
					<a class="mui-navigate-right" id="mycards">
						<span class="mui-icon iconfont icon-wodeqiabao"> </span>
						还款管理
					</a>
				</li>
				<li class="mui-table-view-cell me-setting-notice">
					<a class="mui-navigate-right" id="buddy_list">
						<span class="mui-icon iconfont icon-haoyouliebiao"> </span>
						好友列表
					</a>
				</li>
			</ul>
		</div>

		<script src="../../js/mui.js"></script>
		<script src="../../js/common.js"></script>
		<script src="../../js/vue.min.js"></script>
		<script src="../../js/md5.min.js"></script>

		<script type="text/javascript">
			mui.init()

			function da() {
				var da = {};
				var token = localStorage.logintoken;
				//vue.js的数据
				da["token"] = token;

				var signkey = localStorage.signkey;
				var signcode = sign(da, signkey);

				da['sign'] = signcode;
				return da;
			}
			mui.plusReady(function() {
				// 更新用户数据
				var userUrl = address("/api/User/user");
				mui.post(userUrl,
					da(),
					function(data) {
						// console.log(JSON.stringify(data));

						if (data.code == 1 && (typeof(token) != undefined)) {
							plus.nativeUI.toast(data.msg);

							vm.total_income = getEarn(data.data.total_income);
							vm.balance = getEarn(data.data.balance);

							localStorage.userinfo = JSON.stringify(data.data);
						} else {
							plus.nativeUI.toast(data.msg);
						}
					}, 'json')


				document.getElementById("mybalance").addEventListener("tap", function() {
					mui.openWindow({
						url: 'intelli_payment/my_banlance.html',
						id: 'my_banlance',
						waiting: {
							autoShow: false,
						}
					})
				})
				document.getElementById("ip-myincome").addEventListener("tap", function() {
					mui.openWindow({
						url: 'intelli_payment/my_earnings.html',
						id: 'my_earnings',
						waiting: {
							autoShow: false,
						}
					})
				})
				document.getElementById("mycards").addEventListener("tap", function() {
					mui.openWindow({
						url: 'intelli_payment/my_bag.html',
						id: 'my_bag',
						createNew: true,
					})
				})
				document.getElementById("buddy_list").addEventListener("tap", function() {
					mui.openWindow({
						url: 'intelli_payment/buddy_list.html',
						id: 'buddy_list',
						waiting: {
							autoShow: false,
						}
					})
				});
				// 				document.getElementById("repayment-setPlan").addEventListener("tap",function(){
				// 						mui.openWindow({
				// 							url:'intelli_payment/repayment_setPlan.html',
				// 							id: 'repayment_setPlan',
				// 							waiting:{
				// 								autoShow:false,
				// 							}
				// 						})
				// 				})
								document.getElementById("repayment-Plan").addEventListener("tap",function(){
										mui.openWindow({
											url:'intelli_payment/repayment_plan_list.html',
											id: 'repayment_plan_list',
											waiting:{
												autoShow:false,
											}
										})
								})
			});
			var vm = new Vue({
				el: '#mui-content',
				data: {
					total_income: '0.00',
					balance: '0.00'
				}
			});
		</script>
	</body>

</html>
